clear all
cap log close
do "$data/PSID/childbirth/CAH85_21"

//clean up
ren *, lower
gen uniqid = cah3*1000 + cah4
ds uniqid, not
keep uniqid cah15

//drop bad values
ren cah birth_year_
drop if birth_year_ == 9998
drop if birth_year_ == 9999

//reshape
sort uniqid
bys uniqid: gen count = _n
reshape wide birth_year_, i(uniqid) j(count)
save "$temp/psid_childbirth", replace